package com.lantosec.hmrp.modules.eval.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.eval.vo.EvalPlanVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 考评计划 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-17
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EvalPlan extends BaseEntity<EvalPlanVO> {

    private static final long serialVersionUID = 1L;
    public EvalPlan(EvalPlanVO vo){
        this.evalPlanId = vo.getEvalPlanId();
        this.evalPlanName = vo.getEvalPlanName();
        this.evalPlanType = vo.getEvalPlanType();
        this.evalPlanCycle = vo.getEvalPlanCycle();
        this.execDeptId = vo.getExecDeptId();
        this.evalPlanCycleNum = vo.getEvalPlanCycleNum();
        this.startDate = vo.getStartDate();
        this.endDate = vo.getEndDate();
        this.evalMode = vo.getEvalMode();
        this.executorMode = vo.getExecutorMode();
        this.targetMode = vo.getTargetMode();
        this.state = vo.getState();
        this.execNum = vo.getExecNum();
        this.delay = vo.getDelay();
        this.createUserId = vo.getCreateUserId();
        this.createUser = vo.getCreateUser();
        this.createTime = vo.getCreateTime();
        this.editorUserId = vo.getEditorUserId();
        this.editorUser = vo.getEditorUser();
        this.editorTime = vo.getEditorTime();
        this.planTargetId = vo.getPlanTargetId();
        this.targetNum = vo.getTargetNum();
    }

    @Override
    public EvalPlanVO convertToVO(){
        return new EvalPlanVO(this);
    }


    /**
     * 考评计划ID
     */
    @TableId(value = "eval_plan_id", type = IdType.AUTO)
    private Integer evalPlanId;

    /**
     * 考评计划名称
     */
    private String evalPlanName;

    /**
     * 考评计划类型(1常规计划2专项计划)
     */
    private Integer evalPlanType;

    /**
     * 考评计划周期(0临时2周3月4季度5年)
     */
    private Integer evalPlanCycle;

    /**
     * 执行责任科室
     */
    private String execDeptId;

    /**
     * 考评计划周期执行次数(默认1)
     */
    private Integer evalPlanCycleNum;

    /**
     * 计划开始日期
     */
    private String startDate;

    /**
     * 计划结束日期
     */
    @TableField(fill = FieldFill.UPDATE)
    private String endDate;

    /**
     * 考评形式(1填报2巡查)
     */
    private Integer evalMode;

    /**
     * 执行者形式(1指定部门2指定个人)
     */
    private Integer executorMode;

    /**
     * 考核对象形式(1指定部门2指定个人3全部人员)
     */
    private Integer targetMode;

    /**
     * 计划状态(1暂停2启用3到期4作废)
     */
    private Integer state;

    /**
     * 记录执行次数
     */
    private Integer execNum;

    /**
     * 允许延期(工作日)
     */
    private Integer delay;

    /**
     * 执行对象数
     */
    @TableField(exist = false)
    private Integer targetNum;

    /**
     * 创建人ID
     */
    private String createUserId;

    /**
     * 创建人
     */
    private String createUser;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 最后编辑人ID
     */
    private String editorUserId;

    /**
     * 最后编辑人
     */
    private String editorUser;

    /**
     * 最后编辑时间
     */
    private Date editorTime;

    @TableField(exist = false)
    private Integer planTargetId;


    public enum ColName {
        eval_plan_id, eval_plan_name, eval_plan_type, eval_plan_cycle, exec_dept_id, eval_plan_cycle_num, start_date, end_date, eval_mode, executor_mode, target_mode, state, exec_num, delay, create_user_id, create_user, create_time, editor_user_id, editor_user, editor_time,
    }
}
